#! /bin/bash

# The eupdatedb script _needs_ to be installed with the filename 'eupdatedb'
# because it does things based on basename $0.

# Run some script

SCRIPT="/usr/sbin/eupdatedb"
SCRIPTPREOPTS="nice -n 19"
SCRIPTOPTS="--quiet"
PRECOMMAND=""
POSTCOMMAND=""
DATE="`date +%Y%m%d`"
LOG="/var/log/`basename ${SCRIPT}`"

${PRECOMMAND}

# Start logging
echo "--- Starting ${SCRIPT} for ${DATE} ---" >> ${LOG}

if [ "`${SCRIPTPREOPTS} ${SCRIPT} ${SCRIPTOPTS}`" ]
then
	 echo "${SCRIPT}: success." >> ${LOG}
else
	echo "ERROR: ${SCRIPT} failed." >> ${LOG}
fi

# Cleanup tasks
${POSTCOMMAND}

# End logging
echo "--- Ending ${SCRIPT} for ${DATE} ---" >> ${LOG}
